< previous page page_515 next page >

Page 515
At this point, you can display the variables or set any of the other debugging options. If you can identify the statement that caused the error, a single breakpoint might help you in locating the problem. More often than not, you only know the general section of code that caused the error. A breakpoint will help you isolate the problem area. By using breakpoints, you can step through the logic of your application to see which line or section of code is executed depending on the data being processed.
The Step Into and Step Over commands are used to observe the effect each statement has on the overall process. You can also skip over statements or back up by specifying the line of code to execute. The three step commands that you can use are listed in Table 18.4.
TABLE 18.4. THE AVAILABLE STEP COMMANDS IN VISUAL BASIC.
CommandDescription
Step IntoExecutes the current statement and then stops at the next line, even if it's in another procedure
Step OverExecutes the entire procedure called by the current statement and then stops at the statement following the current statement
Step OutExecutes the remainder of the current procedure and stops at the statement following the one that called the procedure

Note
These commands are only available when the application is in Break mode.

The Step Into command executes the application code one statement at a time. This process, also known as single-stepping through the code, enables you to view the effects each statement has on the overall application. When you click the Step Into button or press the F8 key, Visual Basic temporarily switches to runtime, executes the current statement, moves to the next statement, and then switches back to Break mode. Try this in the Address Book project. You should still be at a breakpoint; press the F8 key and the application will execute the statement you are stopped at and then stop at the next executable statement.
The Step Over command is identical to the Step Into command, except when the current statement contains a call to a procedure. Unlike the Step Into command, which will follow the execution into the called procedure, Step Over will execute the procedure as a unit and then stop at the next statement in the current procedure. Suppose, for example, the current statement calls the procedure SizeControls as shown

 
< previous page page_515 next page >

If you like this book, buy it!